from zkl_aiutils_datasets.wrapping import wrap_dataset


def load_dataset_by_huggingface(*args, **kwargs):
    try:
        import datasets
    except ImportError:
        raise NotImplementedError('Package "datasets" is not installed.')

    if not callable(getattr(datasets, 'load_dataset', None)):
        raise NotImplementedError('Package "datasets" is not installed.')

    dataset = datasets.load_dataset(*args, **kwargs)
    dataset = wrap_dataset(dataset)
    return dataset
